.class public Lcom/estrongs/android/util/a0;
.super Ljava/lang/Object;
.source "HttpDownloader.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/estrongs/android/util/a0$d;,
        Lcom/estrongs/android/util/a0$c;
    }
.end annotation


# static fields
.field private static p:Z


# instance fields
.field public a:I

.field private final b:Ljava/lang/String;

.field private c:Ljava/lang/String;

.field private d:Ljava/lang/String;

.field private e:Lcom/estrongs/android/util/a0$c;

.field private f:J

.field private g:J

.field private h:Ljava/lang/Object;

.field private i:Ljava/lang/Thread;

.field private j:Z

.field private k:Z

.field private l:[B

.field private m:Z

.field private n:Ljava/lang/String;

.field private o:[Ljava/lang/Object;


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 4

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 2
    iput v0, p0, Lcom/estrongs/android/util/a0;->a:I

    const-string v1, ".tmp"

    .line 3
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->b:Ljava/lang/String;

    const/4 v1, 0x0

    .line 4
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->c:Ljava/lang/String;

    .line 5
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    .line 6
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    const-wide/16 v2, -0x1

    .line 7
    iput-wide v2, p0, Lcom/estrongs/android/util/a0;->f:J

    const-wide/16 v2, 0x0

    .line 8
    iput-wide v2, p0, Lcom/estrongs/android/util/a0;->g:J

    .line 9
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    .line 10
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->i:Ljava/lang/Thread;

    .line 11
    iput-boolean v0, p0, Lcom/estrongs/android/util/a0;->j:Z

    const/4 v2, 0x1

    .line 12
    iput-boolean v2, p0, Lcom/estrongs/android/util/a0;->k:Z

    .line 13
    iput-boolean v0, p0, Lcom/estrongs/android/util/a0;->m:Z

    const-string v0, "GET"

    .line 14
    iput-object v0, p0, Lcom/estrongs/android/util/a0;->n:Ljava/lang/String;

    .line 15
    iput-object v1, p0, Lcom/estrongs/android/util/a0;->o:[Ljava/lang/Object;

    .line 16
    iput-object p1, p0, Lcom/estrongs/android/util/a0;->c:Ljava/lang/String;

    .line 17
    sget-boolean p1, Lcom/estrongs/android/util/a0;->p:Z

    if-nez p1, :cond_0

    .line 18
    sput-boolean v2, Lcom/estrongs/android/util/a0;->p:Z

    .line 19
    :try_start_0
    new-instance p1, Lcom/estrongs/android/util/a0$d;

    invoke-direct {p1, v1}, Lcom/estrongs/android/util/a0$d;-><init>(Lcom/estrongs/android/util/a0$a;)V

    invoke-static {p1}, Ljavax/net/ssl/HttpsURLConnection;->setDefaultHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V

    const-string p1, "SSL"

    .line 20
    invoke-static {p1}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;

    move-result-object p1

    .line 21
    new-instance v0, Ljava/security/SecureRandom;

    invoke-direct {v0}, Ljava/security/SecureRandom;-><init>()V

    invoke-virtual {p1, v1, v1, v0}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V

    .line 22
    invoke-virtual {p1}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;

    move-result-object p1

    invoke-static {p1}, Ljavax/net/ssl/HttpsURLConnection;->setDefaultSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 23
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_0
    :goto_0
    return-void
.end method

.method static synthetic a(Lcom/estrongs/android/util/a0;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Lcom/estrongs/android/util/a0;->d()V

    return-void
.end method

.method static synthetic b(Lcom/estrongs/android/util/a0;)Z
    .locals 0

    .line 1
    iget-boolean p0, p0, Lcom/estrongs/android/util/a0;->m:Z

    return p0
.end method

.method static synthetic c(Lcom/estrongs/android/util/a0;)Lcom/estrongs/android/util/a0$c;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    return-object p0
.end method

.method private c()V
    .locals 2

    .line 2
    new-instance v0, Lcom/estrongs/android/util/a0$a;

    invoke-direct {v0, p0}, Lcom/estrongs/android/util/a0$a;-><init>(Lcom/estrongs/android/util/a0;)V

    iput-object v0, p0, Lcom/estrongs/android/util/a0;->i:Ljava/lang/Thread;

    const-string v1, "HttpDownloader"

    .line 3
    invoke-virtual {v0, v1}, Ljava/lang/Thread;->setName(Ljava/lang/String;)V

    .line 4
    iget-object v0, p0, Lcom/estrongs/android/util/a0;->i:Ljava/lang/Thread;

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method static synthetic d(Lcom/estrongs/android/util/a0;)Ljava/lang/Object;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    return-object p0
.end method

.method private d()V
    .locals 19

    move-object/from16 v1, p0

    const-string v0, ""

    const-string v2, "no-cache"

    const/4 v4, 0x1

    .line 2
    :try_start_0
    new-instance v5, Ljava/net/URL;

    iget-object v6, v1, Lcom/estrongs/android/util/a0;->c:Ljava/lang/String;

    const-string v7, "@#&=*+-_.,:!?()/~\'%"

    invoke-static {v6, v7}, Landroid/net/Uri;->encode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 3
    invoke-virtual {v5}, Ljava/net/URL;->getQuery()Ljava/lang/String;

    move-result-object v6

    if-eqz v6, :cond_0

    .line 4
    invoke-virtual {v6}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v6

    const-string v7, "http"

    .line 5
    invoke-virtual {v6, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-nez v6, :cond_0

    .line 6
    new-instance v5, Ljava/net/URL;

    iget-object v6, v1, Lcom/estrongs/android/util/a0;->c:Ljava/lang/String;

    invoke-static {v6}, Lcom/estrongs/android/util/h0;->k(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 7
    :cond_0
    iget v6, v1, Lcom/estrongs/android/util/a0;->a:I

    if-nez v6, :cond_1

    iget-object v6, v1, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    if-eqz v6, :cond_1

    .line 8
    new-instance v6, Ljava/io/File;

    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    iget-object v8, v1, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v8, ".tmp"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    goto :goto_0

    :cond_1
    const/4 v6, 0x0

    .line 9
    :goto_0
    invoke-virtual {v5}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v5

    check-cast v5, Ljava/net/HttpURLConnection;

    const/16 v7, 0x4e20

    .line 10
    invoke-virtual {v5, v7}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V

    const v7, 0xea60

    .line 11
    invoke-virtual {v5, v7}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V

    .line 12
    iget-object v7, v1, Lcom/estrongs/android/util/a0;->n:Ljava/lang/String;

    invoke-virtual {v5, v7}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V

    .line 13
    iget-boolean v7, v1, Lcom/estrongs/android/util/a0;->k:Z

    const-wide/16 v8, 0x0

    if-eqz v7, :cond_2

    iget v7, v1, Lcom/estrongs/android/util/a0;->a:I

    if-nez v7, :cond_2

    if-eqz v6, :cond_2

    invoke-virtual {v6}, Ljava/io/File;->length()J

    move-result-wide v10

    cmp-long v7, v10, v8

    if-lez v7, :cond_2

    .line 14
    invoke-virtual {v6}, Ljava/io/File;->length()J

    move-result-wide v10

    iput-wide v10, v1, Lcom/estrongs/android/util/a0;->g:J

    const-string v7, "Range"

    .line 15
    new-instance v10, Ljava/lang/StringBuilder;

    invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V

    const-string v11, "bytes="

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide v11, v1, Lcom/estrongs/android/util/a0;->g:J

    invoke-virtual {v10, v11, v12}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v11, "-"

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v5, v7, v10}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1

    .line 16
    :cond_2
    iput-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    .line 17
    :goto_1
    iget-object v7, v1, Lcom/estrongs/android/util/a0;->o:[Ljava/lang/Object;

    const/4 v10, 0x0

    if-eqz v7, :cond_3

    const/4 v7, 0x0

    .line 18
    :goto_2
    iget-object v11, v1, Lcom/estrongs/android/util/a0;->o:[Ljava/lang/Object;

    array-length v11, v11

    if-ge v7, v11, :cond_3

    .line 19
    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v11, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v12, v1, Lcom/estrongs/android/util/a0;->o:[Ljava/lang/Object;

    add-int/lit8 v13, v7, 0x0

    aget-object v12, v12, v13

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    new-instance v12, Ljava/lang/StringBuilder;

    invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v13, v1, Lcom/estrongs/android/util/a0;->o:[Ljava/lang/Object;

    add-int/lit8 v14, v7, 0x1

    aget-object v13, v13, v14

    invoke-virtual {v12, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v5, v11, v12}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    add-int/lit8 v7, v7, 0x2

    goto :goto_2

    :cond_3
    const-string v0, "Cache-Control"

    .line 20
    invoke-virtual {v5, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    const-string v0, "Pragma"

    .line 21
    invoke-virtual {v5, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    const-string v0, "Accept-Encoding"

    const-string v2, "identity"

    .line 22
    invoke-virtual {v5, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 23
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->n:Ljava/lang/String;

    const-string v2, "POST"

    invoke-virtual {v0, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_4

    .line 24
    invoke-virtual {v5, v4}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V

    .line 25
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->l:[B

    if-eqz v0, :cond_4

    .line 26
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v0

    .line 27
    iget-object v2, v1, Lcom/estrongs/android/util/a0;->l:[B

    invoke-virtual {v0, v2}, Ljava/io/OutputStream;->write([B)V

    .line 28
    invoke-virtual {v0}, Ljava/io/OutputStream;->flush()V

    .line 29
    invoke-virtual {v0}, Ljava/io/OutputStream;->close()V

    .line 30
    :cond_4
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->connect()V

    .line 31
    iget-wide v11, v1, Lcom/estrongs/android/util/a0;->g:J

    cmp-long v0, v11, v8

    if-lez v0, :cond_5

    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getResponseCode()I

    move-result v0

    const/16 v2, 0xce

    if-eq v0, v2, :cond_5

    .line 32
    iput-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    .line 33
    :cond_5
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v0, :cond_6

    .line 34
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v2, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    invoke-interface {v0, v2}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;)V

    .line 35
    :cond_6
    iget-wide v11, v1, Lcom/estrongs/android/util/a0;->g:J

    cmp-long v0, v11, v8

    if-nez v0, :cond_7

    if-eqz v6, :cond_7

    .line 36
    invoke-virtual {v6}, Ljava/io/File;->delete()Z

    .line 37
    invoke-virtual {v6}, Ljava/io/File;->createNewFile()Z

    :cond_7
    if-eqz v6, :cond_8

    .line 38
    new-instance v2, Ljava/io/RandomAccessFile;

    const-string v0, "rw"

    invoke-direct {v2, v6, v0}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_3

    .line 39
    :try_start_1
    iget-wide v6, v1, Lcom/estrongs/android/util/a0;->g:J

    invoke-virtual {v2, v6, v7}, Ljava/io/RandomAccessFile;->seek(J)V

    goto :goto_3

    :cond_8
    const/4 v2, 0x0

    .line 40
    :goto_3
    iget-boolean v0, v1, Lcom/estrongs/android/util/a0;->j:Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_2

    const-string v6, "UserCannelled"

    if-eqz v0, :cond_b

    .line 41
    :try_start_2
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v0, :cond_9

    .line 42
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v5, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    new-instance v7, Ljava/lang/Exception;

    invoke-direct {v7, v6}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    invoke-interface {v0, v5, v7}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;Ljava/lang/Throwable;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_2

    .line 43
    :cond_9
    iput-boolean v4, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v2, :cond_a

    .line 44
    :try_start_3
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0

    :catch_0
    :cond_a
    return-void

    .line 45
    :cond_b
    :try_start_4
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getContentLength()I

    move-result v0
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_2

    const-string v7, "error"

    if-gez v0, :cond_f

    :try_start_5
    const-string v0, "Transfer-Encoding"

    .line 46
    invoke-virtual {v5, v0}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string v11, "chunked"

    .line 47
    invoke-virtual {v11, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_c

    const/4 v0, 0x0

    const/4 v11, 0x1

    goto :goto_4

    :cond_c
    const/4 v0, 0x1

    const/4 v11, 0x0

    :goto_4
    if-eqz v0, :cond_10

    .line 48
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v0, :cond_d

    .line 49
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v5, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    new-instance v6, Ljava/lang/Exception;

    invoke-direct {v6, v7}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    invoke-interface {v0, v5, v6}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;Ljava/lang/Throwable;)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_2

    .line 50
    :cond_d
    iput-boolean v4, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v2, :cond_e

    .line 51
    :try_start_6
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_1

    :catch_1
    :cond_e
    return-void

    :cond_f
    int-to-long v11, v0

    .line 52
    :try_start_7
    iget-wide v13, v1, Lcom/estrongs/android/util/a0;->g:J

    add-long/2addr v11, v13

    iput-wide v11, v1, Lcom/estrongs/android/util/a0;->f:J

    const/4 v11, 0x0

    .line 53
    :cond_10
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v12
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_2

    .line 54
    :try_start_8
    iget v0, v1, Lcom/estrongs/android/util/a0;->a:I

    const/16 v13, 0x4000

    if-ne v0, v4, :cond_12

    .line 55
    iget-wide v14, v1, Lcom/estrongs/android/util/a0;->f:J

    cmp-long v0, v14, v8

    if-lez v0, :cond_11

    .line 56
    iget-wide v8, v1, Lcom/estrongs/android/util/a0;->f:J

    long-to-int v0, v8

    new-array v0, v0, [B

    goto :goto_5

    :cond_11
    new-array v0, v13, [B

    goto :goto_5

    :cond_12
    new-array v0, v13, [B

    .line 57
    :goto_5
    iget-object v8, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v8, :cond_13

    .line 58
    iget-object v13, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v14, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    iget-wide v8, v1, Lcom/estrongs/android/util/a0;->f:J

    iget-wide v3, v1, Lcom/estrongs/android/util/a0;->g:J

    move-wide v15, v8

    move-wide/from16 v17, v3

    invoke-interface/range {v13 .. v18}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;JJ)V

    .line 59
    :cond_13
    iput-boolean v10, v1, Lcom/estrongs/android/util/a0;->m:Z

    .line 60
    new-instance v3, Lcom/estrongs/android/util/a0$b;

    invoke-direct {v3, v1}, Lcom/estrongs/android/util/a0$b;-><init>(Lcom/estrongs/android/util/a0;)V

    .line 61
    invoke-virtual {v3}, Ljava/lang/Thread;->start()V

    if-nez v11, :cond_15

    const/4 v3, 0x0

    .line 62
    :goto_6
    array-length v4, v0

    sub-int/2addr v4, v3

    invoke-virtual {v12, v0, v3, v4}, Ljava/io/InputStream;->read([BII)I

    move-result v4

    if-lez v4, :cond_19

    iget-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    iget-wide v13, v1, Lcom/estrongs/android/util/a0;->f:J

    cmp-long v11, v8, v13

    if-gez v11, :cond_19

    iget-boolean v8, v1, Lcom/estrongs/android/util/a0;->j:Z

    if-nez v8, :cond_19

    if-eqz v2, :cond_14

    .line 63
    invoke-virtual {v2, v0, v10, v4}, Ljava/io/RandomAccessFile;->write([BII)V

    const/4 v3, 0x0

    goto :goto_7

    :cond_14
    add-int/2addr v3, v4

    .line 64
    :goto_7
    iget-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    int-to-long v13, v4

    add-long/2addr v8, v13

    iput-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    goto :goto_6

    :cond_15
    if-nez v2, :cond_16

    .line 65
    new-instance v3, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v3}, Ljava/io/ByteArrayOutputStream;-><init>()V

    goto :goto_8

    :cond_16
    const/4 v3, 0x0

    .line 66
    :goto_8
    invoke-virtual {v12, v0}, Ljava/io/InputStream;->read([B)I

    move-result v4

    if-lez v4, :cond_18

    iget-boolean v8, v1, Lcom/estrongs/android/util/a0;->j:Z

    if-nez v8, :cond_18

    if-eqz v2, :cond_17

    .line 67
    invoke-virtual {v2, v0, v10, v4}, Ljava/io/RandomAccessFile;->write([BII)V

    goto :goto_9

    .line 68
    :cond_17
    invoke-virtual {v3, v0, v10, v4}, Ljava/io/ByteArrayOutputStream;->write([BII)V

    .line 69
    :goto_9
    iget-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    int-to-long v13, v4

    add-long/2addr v8, v13

    iput-wide v8, v1, Lcom/estrongs/android/util/a0;->g:J

    goto :goto_8

    :cond_18
    if-nez v2, :cond_19

    .line 70
    invoke-virtual {v3}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v0

    :cond_19
    const/4 v3, 0x1

    .line 71
    iput-boolean v3, v1, Lcom/estrongs/android/util/a0;->m:Z

    .line 72
    iget-boolean v3, v1, Lcom/estrongs/android/util/a0;->j:Z

    if-eqz v3, :cond_1d

    .line 73
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v0, :cond_1a

    .line 74
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v3, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    new-instance v4, Ljava/lang/Exception;

    invoke-direct {v4, v6}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    invoke-interface {v0, v3, v4}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;Ljava/lang/Throwable;)V
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_1

    :cond_1a
    const/4 v3, 0x1

    .line 75
    iput-boolean v3, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v2, :cond_1b

    .line 76
    :try_start_9
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V

    :cond_1b
    if-eqz v12, :cond_1c

    .line 77
    invoke-virtual {v12}, Ljava/io/InputStream;->close()V
    :try_end_9
    .catch Ljava/lang/Exception; {:try_start_9 .. :try_end_9} :catch_2

    :catch_2
    :cond_1c
    return-void

    .line 78
    :cond_1d
    :try_start_a
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getResponseCode()I

    move-result v3

    const/16 v4, 0x12c

    if-lt v3, v4, :cond_21

    .line 79
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v0, :cond_1e

    .line 80
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v3, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    new-instance v4, Ljava/lang/Exception;

    invoke-direct {v4, v7}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    invoke-interface {v0, v3, v4}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;Ljava/lang/Throwable;)V
    :try_end_a
    .catchall {:try_start_a .. :try_end_a} :catchall_1

    :cond_1e
    const/4 v3, 0x1

    .line 81
    iput-boolean v3, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v2, :cond_1f

    .line 82
    :try_start_b
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V

    :cond_1f
    if-eqz v12, :cond_20

    .line 83
    invoke-virtual {v12}, Ljava/io/InputStream;->close()V
    :try_end_b
    .catch Ljava/lang/Exception; {:try_start_b .. :try_end_b} :catch_3

    :catch_3
    :cond_20
    return-void

    .line 84
    :cond_21
    :try_start_c
    iget v3, v1, Lcom/estrongs/android/util/a0;->a:I

    const/4 v4, 0x1

    if-ne v3, v4, :cond_22

    .line 85
    new-instance v3, Ljava/lang/String;

    invoke-direct {v3, v0}, Ljava/lang/String;-><init>([B)V

    :cond_22
    if-eqz v2, :cond_23

    .line 86
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V

    .line 87
    invoke-direct/range {p0 .. p0}, Lcom/estrongs/android/util/a0;->e()V
    :try_end_c
    .catchall {:try_start_c .. :try_end_c} :catchall_1

    const/4 v3, 0x0

    goto :goto_a

    :cond_23
    move-object v3, v2

    .line 88
    :goto_a
    :try_start_d
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v0, :cond_24

    .line 89
    iget-object v0, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v2, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    invoke-interface {v0, v2}, Lcom/estrongs/android/util/a0$c;->b(Ljava/lang/Object;)V
    :try_end_d
    .catchall {:try_start_d .. :try_end_d} :catchall_0

    :cond_24
    const/4 v2, 0x1

    .line 90
    iput-boolean v2, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v3, :cond_25

    .line 91
    :try_start_e
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V

    :cond_25
    if-eqz v12, :cond_26

    .line 92
    invoke-virtual {v12}, Ljava/io/InputStream;->close()V
    :try_end_e
    .catch Ljava/lang/Exception; {:try_start_e .. :try_end_e} :catch_4

    :catch_4
    :cond_26
    return-void

    :catchall_0
    move-exception v0

    goto :goto_c

    :catchall_1
    move-exception v0

    move-object v3, v2

    goto :goto_c

    :catchall_2
    move-exception v0

    move-object v3, v2

    goto :goto_b

    :catchall_3
    move-exception v0

    const/4 v3, 0x0

    :goto_b
    const/4 v12, 0x0

    .line 93
    :goto_c
    :try_start_f
    invoke-virtual {v0}, Ljava/lang/Throwable;->printStackTrace()V

    .line 94
    iget-object v2, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    if-eqz v2, :cond_27

    .line 95
    iget-object v2, v1, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    iget-object v4, v1, Lcom/estrongs/android/util/a0;->h:Ljava/lang/Object;

    invoke-interface {v2, v4, v0}, Lcom/estrongs/android/util/a0$c;->a(Ljava/lang/Object;Ljava/lang/Throwable;)V
    :try_end_f
    .catchall {:try_start_f .. :try_end_f} :catchall_4

    :cond_27
    const/4 v2, 0x1

    .line 96
    iput-boolean v2, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v3, :cond_28

    .line 97
    :try_start_10
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V

    :cond_28
    if-eqz v12, :cond_29

    .line 98
    invoke-virtual {v12}, Ljava/io/InputStream;->close()V
    :try_end_10
    .catch Ljava/lang/Exception; {:try_start_10 .. :try_end_10} :catch_5

    :catch_5
    :cond_29
    return-void

    :catchall_4
    move-exception v0

    const/4 v2, 0x1

    .line 99
    iput-boolean v2, v1, Lcom/estrongs/android/util/a0;->m:Z

    if-eqz v3, :cond_2a

    .line 100
    :try_start_11
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V

    :cond_2a
    if-eqz v12, :cond_2b

    .line 101
    invoke-virtual {v12}, Ljava/io/InputStream;->close()V
    :try_end_11
    .catch Ljava/lang/Exception; {:try_start_11 .. :try_end_11} :catch_6

    .line 102
    :catch_6
    :cond_2b
    goto :goto_e

    :goto_d
    throw v0

    :goto_e
    goto :goto_d
.end method

.method static synthetic e(Lcom/estrongs/android/util/a0;)J
    .locals 2

    .line 1
    iget-wide v0, p0, Lcom/estrongs/android/util/a0;->f:J

    return-wide v0
.end method

.method private e()V
    .locals 4

    .line 2
    :try_start_0
    new-instance v0, Ljava/io/File;

    iget-object v1, p0, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 3
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 4
    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    .line 5
    :cond_0
    new-instance v1, Ljava/io/File;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    iget-object v3, p0, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v3, ".tmp"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 6
    invoke-virtual {v1, v0}, Ljava/io/File;->renameTo(Ljava/io/File;)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :catch_0
    return-void
.end method

.method static synthetic f(Lcom/estrongs/android/util/a0;)J
    .locals 2

    .line 1
    iget-wide v0, p0, Lcom/estrongs/android/util/a0;->g:J

    return-wide v0
.end method


# virtual methods
.method public a()Ljava/lang/String;
    .locals 1

    .line 6
    iget-object v0, p0, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    return-object v0
.end method

.method public a(Lcom/estrongs/android/util/a0$c;)V
    .locals 0

    .line 5
    iput-object p1, p0, Lcom/estrongs/android/util/a0;->e:Lcom/estrongs/android/util/a0$c;

    return-void
.end method

.method public a(Ljava/lang/String;)V
    .locals 2

    .line 2
    :try_start_0
    new-instance v0, Ljava/io/File;

    invoke-static {p1}, Lcom/estrongs/android/util/h0;->M(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 3
    invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 4
    :catch_0
    iput-object p1, p0, Lcom/estrongs/android/util/a0;->d:Ljava/lang/String;

    return-void
.end method

.method public b()V
    .locals 2

    const-wide/16 v0, 0x0

    .line 2
    iput-wide v0, p0, Lcom/estrongs/android/util/a0;->g:J

    .line 3
    invoke-direct {p0}, Lcom/estrongs/android/util/a0;->c()V

    return-void
.end method
